<html>
<head><meta charset="utf-8"><title>Unified vector types · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html">Unified vector types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="248169421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169421">(Aug 03 2021 at 00:22)</a>:</h4>
<p>Well, here's a wrench:</p>
<div class="codehilite"><pre><span></span><code>error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
  --&gt; crates/core_simd/src/vector.rs:30:1
   |
30 | pub struct Simd&lt;Element: SimdElement, const LANES: usize&gt;([Element; LANES]) where crate::LaneCount&lt;LANES&gt;: crate::SupportedLaneCount;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre></div>



<a name="248169455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169455">(Aug 03 2021 at 00:22)</a>:</h4>
<p>I feel there's no reason this should be checked pre-monomorphisation</p>



<a name="248169579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169579">(Aug 03 2021 at 00:24)</a>:</h4>
<p>I think it's worth checking pre-monomorphization, however it should allow things it can't prove are wrong rather than only allow things it can prove correct.</p>



<a name="248169596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169596">(Aug 03 2021 at 00:24)</a>:</h4>
<p>Yes, that's what I mean</p>



<a name="248169654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169654">(Aug 03 2021 at 00:25)</a>:</h4>
<p>perhaps I'll put together <em>that</em> PR tonight.  I doubt it's too difficult...</p>



<a name="248169861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169861">(Aug 03 2021 at 00:29)</a>:</h4>
<p><code>rustc_typeck\src\check\check.rs</code></p>



<a name="248169874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248169874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248169874">(Aug 03 2021 at 00:29)</a>:</h4>
<p>yup</p>



<a name="248170006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248170006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248170006">(Aug 03 2021 at 00:31)</a>:</h4>
<p>What if we define a well-known symbol (a trait) associated with vector types?</p>



<a name="248170084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248170084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248170084">(Aug 03 2021 at 00:32)</a>:</h4>
<p>Hm</p>



<a name="248170138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248170138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248170138">(Aug 03 2021 at 00:33)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[lang = </span><span class="s">"simd_element"</span><span class="cp">]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">unsafe</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">SimdElement</span><span class="w"> </span>: <span class="nc">Sealed</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="248171267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248171267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248171267">(Aug 03 2021 at 00:49)</a>:</h4>
<p>Yeah just a one line change in the compiler</p>



<a name="248171279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248171279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248171279">(Aug 03 2021 at 00:49)</a>:</h4>
<p>(as far as I can tell, building/testing is going to take like 100x as long)</p>



<a name="248171609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248171609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248171609">(Aug 03 2021 at 00:55)</a>:</h4>
<p>What's your diff?</p>



<a name="248172208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248172208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248172208">(Aug 03 2021 at 01:04)</a>:</h4>
<div class="codehilite"><pre><span></span><code>diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs
index b5db3331d04..ba99e0c03d8 100644
--- a/compiler/rustc_typeck/src/check/check.rs
+++ b/compiler/rustc_typeck/src/check/check.rs
@@ -1220,6 +1220,7 @@ pub fn check_simd(tcx: TyCtxt&lt;&#39;_&gt;, sp: Span, def_id: LocalDefId) {
             match e.kind() {
                 ty::Param(_) =&gt; (), // pass struct&lt;T&gt;(T, T, T, T) through, let monomorphization catch errors
                 ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::RawPtr(_) =&gt; (), // struct(u8, u8, u8, u8) is ok
+                ty::Array(t, _) if matches!(t.kind(), ty::Param(_)) =&gt; (), // pass struct&lt;T&gt;([T; N]) through, let monomorphization catch errors
                 ty::Array(t, _clen)
                     if matches!(
                         t.kind(),
</code></pre></div>



<a name="248174116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174116">(Aug 03 2021 at 01:40)</a>:</h4>
<p>oh whoops brainspasm. Yes this is passing tests, looks like.</p>



<a name="248174299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174299">(Aug 03 2021 at 01:44)</a>:</h4>
<blockquote>
<p>test result: FAILED. 11961 passed; 1 failed; 135 ignored; 0 measured; 0 filtered out; finished in 294.14s</p>
</blockquote>
<p>the test that fails is the one that always fails on some platforms :P</p>



<a name="248174316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174316">(Aug 03 2021 at 01:45)</a>:</h4>
<p>I'm still building LLVM :)</p>



<a name="248174370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174370">(Aug 03 2021 at 01:46)</a>:</h4>
<p>Jubilee has the tech hookup, builds LLVM in 0.68 seconds just for kicks</p>



<a name="248174371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174371">(Aug 03 2021 at 01:46)</a>:</h4>
<p>I think all we need is to add a test that it actually does what I think it does</p>



<a name="248174375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174375">(Aug 03 2021 at 01:46)</a>:</h4>
<p>uhh you should use<br>
<code>download-ci-llvm = true</code></p>



<a name="248174380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174380">(Aug 03 2021 at 01:46)</a>:</h4>
<p>in your config.toml</p>



<a name="248174383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174383">(Aug 03 2021 at 01:46)</a>:</h4>
<p>oh right, I have mine set up for codegen so asserts on</p>



<a name="248174385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174385">(Aug 03 2021 at 01:46)</a>:</h4>
<p>but I don't really need that</p>



<a name="248174402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174402">(Aug 03 2021 at 01:47)</a>:</h4>
<p>lol I don't have Mara's machine. SHE has a system that builds LLVM in seconds for realsies.</p>



<a name="248174417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174417">(Aug 03 2021 at 01:47)</a>:</h4>
<p>wasn't it that her machine builds it in like 1 min and yours builds it in 6 min?</p>



<a name="248174420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174420">(Aug 03 2021 at 01:47)</a>:</h4>
<p>like those are all still wildly fast values</p>



<a name="248174465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174465">(Aug 03 2021 at 01:48)</a>:</h4>
<p>I've built LLVM countless times at work on some pretty decent servers but it still takes like half an hour!</p>



<a name="248174480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174480">(Aug 03 2021 at 01:48)</a>:</h4>
<p>which machine do you have?</p>



<a name="248174487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174487">(Aug 03 2021 at 01:48)</a>:</h4>
<p>i think 30-45min on my desktop, i forget exactly but i did do it once for a thing</p>



<a name="248174532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174532">(Aug 03 2021 at 01:49)</a>:</h4>
<p>specifically for building the compiler, IIRC.</p>



<a name="248174716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174716">(Aug 03 2021 at 01:52)</a>:</h4>
<p>i have a Ryzen 3900X...it builds LLVM in somewhere &gt;10min iirc, I'll be finding out in detail when I start working on LLVM again</p>



<a name="248174753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174753">(Aug 03 2021 at 01:53)</a>:</h4>
<p>I guess now that I think about it I'm including clang/binutils in that time</p>



<a name="248174759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174759">(Aug 03 2021 at 01:53)</a>:</h4>
<p>and lld...</p>



<a name="248174804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174804">(Aug 03 2021 at 01:54)</a>:</h4>
<p>lld can't even link GBA code, joke linker</p>



<a name="248174840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174840">(Aug 03 2021 at 01:54)</a>:</h4>
<p>binutils...I thought rustc uses the system binutils on linux...</p>



<a name="248174867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174867">(Aug 03 2021 at 01:55)</a>:</h4>
<p>doesn't mean the "build llvm" path doesn't build the tools anyway</p>



<a name="248174913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174913">(Aug 03 2021 at 01:56)</a>:</h4>
<p>welp</p>



<a name="248174920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248174920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248174920">(Aug 03 2021 at 01:57)</a>:</h4>
<p>I don't know for sure either way, but i could easily imagine that it builds them to have them available for when you want them</p>



<a name="248179107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248179107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248179107">(Aug 03 2021 at 03:39)</a>:</h4>
<p>Got distracted but opened <a href="https://github.com/rust-lang/rust/issues/87716">#87716</a></p>



<a name="248182744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248182744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248182744">(Aug 03 2021 at 05:08)</a>:</h4>
<p>Approved.</p>



<a name="248284883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248284883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248284883">(Aug 03 2021 at 21:41)</a>:</h4>
<p>Somewhat related, I wonder if GATs are useful to us? <a href="https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html">https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html</a></p>



<a name="248285023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248285023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248285023">(Aug 03 2021 at 21:42)</a>:</h4>
<p>Not necessarily for our public types but perhaps for helper types</p>



<a name="248290252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248290252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248290252">(Aug 03 2021 at 22:46)</a>:</h4>
<p><span aria-label="eyes" class="emoji emoji-1f440" role="img" title="eyes">:eyes:</span></p>



<a name="248434859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248434859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248434859">(Aug 05 2021 at 03:34)</a>:</h4>
<p>So one thing I'm running into is that to implement functions with traits rather than over each type individually, I think we still need macros (so it doesn't necessarily clean up every function)</p>



<a name="248434949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248434949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248434949">(Aug 05 2021 at 03:37)</a>:</h4>
<p>it also makes a few things a little confusing like</p>
<div class="codehilite"><pre><span></span><code>impl&lt;Element, const LANES: usize&gt; Simd&lt;Element, LANES&gt; {
    fn lanes_ge(self, other: Self) -&gt; Mask&lt;Element::Mask, LANES&gt; { ... }
}
</code></pre></div>



<a name="248434964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248434964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248434964">(Aug 05 2021 at 03:37)</a>:</h4>
<p>it's not immediately obvious what <code>Element::Mask</code> is</p>



<a name="248435009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248435009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248435009">(Aug 05 2021 at 03:38)</a>:</h4>
<p>though it may still be beneficial over <code>lanes_ge</code> existing only once rather than 12 times</p>



<a name="248435800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248435800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248435800">(Aug 05 2021 at 03:59)</a>:</h4>
<p>I think this is going to take long enough that we want to decide beforehand whether we actually want this or not</p>



<a name="248435860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248435860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248435860">(Aug 05 2021 at 04:00)</a>:</h4>
<p>I was hoping it would be quicker but implementing all of the <code>core::ops</code> traits is going to take a very long time to go through</p>



<a name="248438014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438014">(Aug 05 2021 at 04:49)</a>:</h4>
<p>This doesn't quite sound like the correct design then.</p>



<a name="248438066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438066">(Aug 05 2021 at 04:50)</a>:</h4>
<p>Well, it would have been quicker if it was the original design</p>



<a name="248438096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438096">(Aug 05 2021 at 04:51)</a>:</h4>
<p>^^;;</p>



<a name="248438153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438153">(Aug 05 2021 at 04:52)</a>:</h4>
<p>But one thing I ran into that was slightly concerning, for example, is that signum is implemented for both signed integers and floats, so it would probably require its own trait</p>



<a name="248438154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438154">(Aug 05 2021 at 04:52)</a>:</h4>
<p>The mask being a property of the element rather than vector seems wrong, in particular.</p>



<a name="248438241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438241">(Aug 05 2021 at 04:54)</a>:</h4>
<p>It's unfortunate because it seems that for certain things, such as shuffles, array conversions, etc, it makes sense to be a single type</p>



<a name="248438248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438248">(Aug 05 2021 at 04:54)</a>:</h4>
<p>But for the int, float, etc ops it makes more sense to be separate types</p>



<a name="248438269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438269">(Aug 05 2021 at 04:55)</a>:</h4>
<p>(I think I am describing traits)</p>



<a name="248438509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438509">(Aug 05 2021 at 04:59)</a>:</h4>
<p>One thing that we didn't try, which is an inversion of what we currently have, is there is a single Simd type, which implements all of the things like splat, shuffle, etc, and then there are Float, Int traits that implement the special functions</p>



<a name="248438544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438544">(Aug 05 2021 at 04:59)</a>:</h4>
<p>"This is a SIMD vector, also this one in particular can do Float things"</p>



<a name="248438865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438865">(Aug 05 2021 at 05:03)</a>:</h4>
<p>This feels backwards at first because for example i8 and f32 aren't two instances of the same type, but here we really fundamentally have arrays</p>



<a name="248438930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438930">(Aug 05 2021 at 05:04)</a>:</h4>
<p>A good question might be why wasn't this done with atomics though, for example</p>



<a name="248438953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438953">(Aug 05 2021 at 05:04)</a>:</h4>
<p>Well atomics aren't really the best API to begin with</p>



<a name="248438979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438979">(Aug 05 2021 at 05:05)</a>:</h4>
<p>I've had to be vehemently against Volatile stuff taking on the same path as Atomic stuff does, for example.</p>



<a name="248438997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248438997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248438997">(Aug 05 2021 at 05:05)</a>:</h4>
<p>Yeah, it's possible that it was just a mistake</p>



<a name="248439050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439050">(Aug 05 2021 at 05:06)</a>:</h4>
<p>I can't help but think fundamentally the type should be Simd&lt;T; N&gt; just as [T; N], the difference is that arrays don't have particular functions for particular Ts</p>



<a name="248439118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439118">(Aug 05 2021 at 05:08)</a>:</h4>
<p>I mean it's a design that looks good enough in the first pass, i'm not saying anyone is a dummy just because we have the atomics api we do, hindsight is 20/20 and all that.</p>
<p>It just doesn't work as a good foundation for more</p>



<a name="248439139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439139">(Aug 05 2021 at 05:09)</a>:</h4>
<p>Also, it's arguably a significantly less complicated API than SIMD</p>



<a name="248439148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439148">(Aug 05 2021 at 05:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Unified.20vector.20types/near/248439050">said</a>:</p>
<blockquote>
<p>I can't help but think fundamentally the type should be Simd&lt;T; N&gt; just as [T; N], the difference is that arrays don't have particular functions for particular Ts</p>
</blockquote>
<p>super spicy wasabi take: maybe they should</p>



<a name="248439171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439171">(Aug 05 2021 at 05:10)</a>:</h4>
<p>Well, if they did would it be better as traits?</p>



<a name="248439231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439231">(Aug 05 2021 at 05:11)</a>:</h4>
<p>so, the "point" of traits, at least one of the points, is that they let others extend what you're building with. If we want to have ops on just, say, i32 and i16, we can just plain impl Simd&lt;i32; N&gt; and impl Simd&lt;i16; N&gt;</p>



<a name="248439279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439279">(Aug 05 2021 at 05:12)</a>:</h4>
<p>I'm imagining something like</p>
<div class="codehilite"><pre><span></span><code>trait Float {
    type Bits;
    fn to_bits(self) -&gt; Simd&lt;Self::Bits; Self::LANES&gt;;
}
</code></pre></div>
<p>as an example</p>



<a name="248439294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439294">(Aug 05 2021 at 05:12)</a>:</h4>
<p>i think a "problem" of this design is that anyone is gonna immediately say "hey why don't scalar types have this stuff?"</p>



<a name="248439298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439298">(Aug 05 2021 at 05:13)</a>:</h4>
<p>and... you're sunk in bikeshed land</p>



<a name="248439324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439324">(Aug 05 2021 at 05:14)</a>:</h4>
<p>Yep. Though I do think we have the good argument of distinguishing between universal, inherent operations, and things that only apply to some vectors</p>



<a name="248439368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439368">(Aug 05 2021 at 05:14)</a>:</h4>
<p>Though alternatively we may end up with exactly the design we have now</p>



<a name="248439404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439404">(Aug 05 2021 at 05:15)</a>:</h4>
<p>Like, we <em>should</em> have traits for numbers, being generic over primitives is something Rust needs for ergonomics. Rust is not fun to use for math.<br>
but i don't think we've got the clout to push a num traits api out in front of a simd api.<br>
And while the "one trait per op" design keeps it simple and works in some crates, T-libs-api will probably balk</p>



<a name="248439495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439495">(Aug 05 2021 at 05:17)</a>:</h4>
<p>Well, one alternative is to make them all one vector type, but implement the functions manually over every valid element type, just like packed_simd</p>



<a name="248439539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439539">(Aug 05 2021 at 05:18)</a>:</h4>
<p>I think that's the worst option, you end up with one page for one type with every function in the entire API</p>



<a name="248439581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439581">(Aug 05 2021 at 05:19)</a>:</h4>
<p>if looking for vector traits, you could look at the code I wrote for <a href="https://github.com/rust-lang/stdsimd/issues/109">stdsimd#109</a> for inspiration</p>



<a name="248439590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439590">(Aug 05 2021 at 05:19)</a>:</h4>
<p>pro: that's the most doable in terms of what you could get T-libs-api to approve because it has no new traits you're adding to the standard library, and traits have a fairly high bar to be added to the standard library.</p>
<p>con: i hate the packed_simd docs and i made the entire <code>wide</code> crate specifically because of how bad the packed_simd docs are.</p>



<a name="248439652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439652">(Aug 05 2021 at 05:20)</a>:</h4>
<p><a href="https://salsa.debian.org/Kazan-team/vector-math/-/blob/master/src/traits.rs">https://salsa.debian.org/Kazan-team/vector-math/-/blob/master/src/traits.rs</a></p>



<a name="248439706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439706">(Aug 05 2021 at 05:22)</a>:</h4>
<p>We could almost get away with no new traits other than unstable traits</p>



<a name="248439744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439744">(Aug 05 2021 at 05:22)</a>:</h4>
<p>Perma-unstable</p>



<a name="248439749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439749">(Aug 05 2021 at 05:22)</a>:</h4>
<p>i really hate the idea of perma-unstable</p>



<a name="248439759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439759">(Aug 05 2021 at 05:22)</a>:</h4>
<p>It's useful in a few cases but yeah, agreed</p>



<a name="248439763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439763">(Aug 05 2021 at 05:22)</a>:</h4>
<p>which would be the perma-unstable trait we'd need?</p>



<a name="248439846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439846">(Aug 05 2021 at 05:24)</a>:</h4>
<p>Well the traits for saying which element types are allowed</p>



<a name="248439856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439856">(Aug 05 2021 at 05:24)</a>:</h4>
<p>They wouldn't be part of the API beyond restricting which types can be used</p>



<a name="248439870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439870">(Aug 05 2021 at 05:25)</a>:</h4>
<p>no reason that needs to be perma-unstable i can think of.</p>



<a name="248439873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439873">(Aug 05 2021 at 05:25)</a>:</h4>
<p>(as in, they're only used for bounds and implementations, and not the actual api fns you call)</p>



<a name="248439884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439884">(Aug 05 2021 at 05:25)</a>:</h4>
<p>Well I am saying they can be perma-unstable for the reason of not adding new traits to std</p>



<a name="248439931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439931">(Aug 05 2021 at 05:26)</a>:</h4>
<p>If we are adding new traits might want to just put the fns directly in the traits</p>



<a name="248439937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439937">(Aug 05 2021 at 05:26)</a>:</h4>
<p>so the traits themselves could be stabilized, but all methods would be perma-unstable implementation details</p>



<a name="248439943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248439943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248439943">(Aug 05 2021 at 05:26)</a>:</h4>
<p>on the other hand: think of how sweet it would be if your repr(transparent) wrapper over an i32 could implement some trait and then suddenly it's SIMD everywhere</p>



<a name="248440022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440022">(Aug 05 2021 at 05:28)</a>:</h4>
<p>I doubt it'll ever be automatic because you'll have to deal with loading and storing data</p>



<a name="248440032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440032">(Aug 05 2021 at 05:28)</a>:</h4>
<p>But it can make the conversion easier</p>



<a name="248440033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440033">(Aug 05 2021 at 05:28)</a>:</h4>
<p>yay! <code>Simd&lt;NonZeroU32&gt;</code></p>



<a name="248440049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440049">(Aug 05 2021 at 05:29)</a>:</h4>
<p>or ranged integers</p>



<a name="248440065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440065">(Aug 05 2021 at 05:29)</a>:</h4>
<p>I'd expect it to be a trait that you manually add to your newtype, and then the compiler has magic which will reject the impl when it's incompatible</p>



<a name="248440071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440071">(Aug 05 2021 at 05:29)</a>:</h4>
<p>or non-NaN floats</p>



<a name="248440119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440119">(Aug 05 2021 at 05:30)</a>:</h4>
<p>At that point why wouldn't you just newtype over the vector instead</p>



<a name="248440131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440131">(Aug 05 2021 at 05:30)</a>:</h4>
<p>I don't think there is any hope of making our API flexible enough for that</p>



<a name="248440157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440157">(Aug 05 2021 at 05:31)</a>:</h4>
<p>the value is that you think of it as a scalar and then when it turns out that you want to process more at once... one line added and bam you're into simd land</p>



<a name="248440173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440173">(Aug 05 2021 at 05:31)</a>:</h4>
<p>but i mean, that's just a thing that would be cool it doesn't have to happen</p>



<a name="248440226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440226">(Aug 05 2021 at 05:32)</a>:</h4>
<p>It would be cool but I think there are too many invariants that are being checked in unusual ways to actually make it happen</p>



<a name="248440250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440250">(Aug 05 2021 at 05:33)</a>:</h4>
<p>wild thought: Rayon has <code>par_iter</code>, we need <code>simd_iter</code> where we don't have to hope it's simple enough for the compiler to auto-vectorize it...</p>



<a name="248440318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440318">(Aug 05 2021 at 05:34)</a>:</h4>
<p>we can do that already ;3 <a href="https://docs.rs/bytemuck/1.7.2/bytemuck/fn.pod_align_to_mut.html">https://docs.rs/bytemuck/1.7.2/bytemuck/fn.pod_align_to_mut.html</a></p>



<a name="248440344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440344">(Aug 05 2021 at 05:35)</a>:</h4>
<p>hmm, don't see simd there...</p>



<a name="248440346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440346">(Aug 05 2021 at 05:35)</a>:</h4>
<p>So I think the two issues with unifying the vector types that I ran into is 1) there are some weird type relationships such as mask or bit representations that I think either need explicit implementations or traits encoding the relationship and 2) there are some name collisions such as integers and floats both having <code>signum</code></p>



<a name="248440391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440391">(Aug 05 2021 at 05:36)</a>:</h4>
<p>Our current implementation successfully avoids both of these problems because the vector types are completely independent</p>



<a name="248440396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440396">(Aug 05 2021 at 05:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Unified.20vector.20types/near/248440344">said</a>:</p>
<blockquote>
<p>hmm, don't see simd there...</p>
</blockquote>
<p>you'd take the <code>&amp;[f32]</code> and <code>pod_align_to::&lt;_, f32x4&gt;</code> with it, getting the initial, simd middle, and tail parts as your return value.</p>



<a name="248440409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440409">(Aug 05 2021 at 05:37)</a>:</h4>
<p>but that is like, not ergonomic on its own, but you know, fix it with more helper code and stuff</p>



<a name="248440415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440415">(Aug 05 2021 at 05:37)</a>:</h4>
<p>ok, so it could be used to implement <code>simd_iter</code></p>



<a name="248440423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440423">(Aug 05 2021 at 05:37)</a>:</h4>
<p>sure</p>



<a name="248440489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440489">(Aug 05 2021 at 05:38)</a>:</h4>
<p><span class="user-mention" data-user-id="312331">@Caleb Zulawski</span> the signum issue is a bit of a pain</p>



<a name="248440509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440509">(Aug 05 2021 at 05:39)</a>:</h4>
<p>make a <code>trait SigNum</code>?</p>



<a name="248440559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440559">(Aug 05 2021 at 05:40)</a>:</h4>
<p>maybe a limited amount of bloat in core::ops would be fine...?</p>



<a name="248440572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440572">(Aug 05 2021 at 05:40)</a>:</h4>
<p>the docs issue is quite real though. packed_simd and nalgebra are incomprihensable</p>



<a name="248440583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440583">(Aug 05 2021 at 05:41)</a>:</h4>
<p>where the trait contains the implementations and you just have one type-generic <code>signum</code> on <code>Simd</code> that's shared between ints and floats</p>



<a name="248440643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440643">(Aug 05 2021 at 05:42)</a>:</h4>
<p>not sure i follow that</p>



<a name="248440645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440645">(Aug 05 2021 at 05:42)</a>:</h4>
<p>like <code>[T]::get()</code> does for indexes and ranges</p>



<a name="248440811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440811">(Aug 05 2021 at 05:46)</a>:</h4>
<p>but the output type of get doesn't change based on T</p>



<a name="248440826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440826">(Aug 05 2021 at 05:47)</a>:</h4>
<p>i guess you're saying that the output of signum can just be Self?</p>



<a name="248440828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440828">(Aug 05 2021 at 05:47)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">SigNum</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">signum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">Output</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="bp">Self</span>: <span class="nc">SigNum</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;&gt;</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">signum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">Output</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">SigNum</span>::<span class="n">signum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248440875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440875">(Aug 05 2021 at 05:48)</a>:</h4>
<p>wait now that I think about it why can't the output type of signum just be Self?</p>



<a name="248440880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440880">(Aug 05 2021 at 05:48)</a>:</h4>
<p>icr if the type changes...</p>



<a name="248440890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440890">(Aug 05 2021 at 05:49)</a>:</h4>
<p>well, floats return a float signum, signed ints return a signed int signum, and normally unsigned ints don't have a signum operation at all</p>



<a name="248440944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248440944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248440944">(Aug 05 2021 at 05:50)</a>:</h4>
<p>ah, ok. so, like my code but replace return type stuff with <code>Self</code></p>



<a name="248441012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441012">(Aug 05 2021 at 05:52)</a>:</h4>
<p>So if we go the route of having two traits (Float, SignedInt) that more or less solves the docs issues I think, as well as finding an appropriate place to put things like signum</p>



<a name="248441014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441014">(Aug 05 2021 at 05:52)</a>:</h4>
<p>if we are going to stabilize the <code>SigNum</code> trait, I think it'd be worthwhile having a separate output type for things like <code>BigFloat</code> which want to take their input by reference or by value</p>



<a name="248441027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441027">(Aug 05 2021 at 05:52)</a>:</h4>
<p>Unsigned ints don't need a trait because they don't have any special functions...</p>



<a name="248441028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441028">(Aug 05 2021 at 05:52)</a>:</h4>
<p>otherwise, just skip output type stuff</p>



<a name="248441086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441086">(Aug 05 2021 at 05:54)</a>:</h4>
<p>what happens to unsigned ints for stuff like <code>reduce_xor</code>, that would have to not be in floats?</p>



<a name="248441121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441121">(Aug 05 2021 at 05:54)</a>:</h4>
<p>so, I think there are things we want an unsigned int trait for</p>



<a name="248441125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441125">(Aug 05 2021 at 05:54)</a>:</h4>
<p>or just a generic int trait</p>



<a name="248441182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441182">(Aug 05 2021 at 05:56)</a>:</h4>
<p>for <a href="https://github.com/rust-lang/stdsimd/issues/109">stdsimd#109</a> I have a generic int trait and a signed int trait and a basically empty unsigned int trait</p>



<a name="248441203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441203">(Aug 05 2021 at 05:57)</a>:</h4>
<p>the signed/unsigned traits have associated types for the opposite signedness</p>



<a name="248441215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441215">(Aug 05 2021 at 05:57)</a>:</h4>
<p>I should note that I'm specifically not trying to solve the problem that something like the <code>num</code> crate is solving</p>



<a name="248441216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441216">(Aug 05 2021 at 05:57)</a>:</h4>
<p>not the worst idea to have that</p>



<a name="248441264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441264">(Aug 05 2021 at 05:58)</a>:</h4>
<p>Yeah I don't think we want to take on the weight of the world like <code>num</code> is doing</p>



<a name="248441471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441471">(Aug 05 2021 at 06:02)</a>:</h4>
<p>I think all we really need to do is segment the fact that there are vectors (arrays with some special memory access operations) and vectors (things that do particular operations on particular element types)</p>



<a name="248441825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441825">(Aug 05 2021 at 06:09)</a>:</h4>
<p>like that we're calling two separate things the same thing, very programmer-like to overload names like that.</p>



<a name="248441888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441888">(Aug 05 2021 at 06:10)</a>:</h4>
<p>Well the way I'm looking at it, a ymm register is a ymm register, we are using it in a floating point mode so we use the float trait</p>



<a name="248441903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441903">(Aug 05 2021 at 06:10)</a>:</h4>
<p>If you were just writing asm you could switch as much as you want</p>



<a name="248441926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441926">(Aug 05 2021 at 06:11)</a>:</h4>
<p>though the bits are just bits, 123int and 123float have very different encoding, so at least that much needs to be preserved</p>



<a name="248441985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248441985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248441985">(Aug 05 2021 at 06:12)</a>:</h4>
<p>Well, I meant legally you could switch as much as you want. Doesn't mean it will do anything useful lol</p>



<a name="248442014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248442014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248442014">(Aug 05 2021 at 06:13)</a>:</h4>
<p>In our API you could switch as much as you want too but we make it a little cumbersome at least</p>



<a name="248442026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248442026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248442026">(Aug 05 2021 at 06:13)</a>:</h4>
<p>well...bitwise and is handy for floats occasionally, you could use them to help round</p>



<a name="248546776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248546776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248546776">(Aug 05 2021 at 22:44)</a>:</h4>
<p>I've been pondering this a bit more and I came to two conclusions</p>



<a name="248546888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248546888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248546888">(Aug 05 2021 at 22:46)</a>:</h4>
<p>1) I think the existence of vectors of pointers is a convincing argument that it would be particularly nice for vectors to be generic over element type as well</p>



<a name="248546918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248546918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248546918">(Aug 05 2021 at 22:46)</a>:</h4>
<p>Not absolutely necessary but as we add new things that can be put into vectors, the API explodes</p>



<a name="248547055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248547055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248547055">(Aug 05 2021 at 22:48)</a>:</h4>
<p>2) I think we already ran into the issue in the past of "when is a vector an array and when is it number-like?". The earliest example I can think of was when we were first designing the API I suggested that it's confusing that "rotate" could mean rotating lanes, as well as the bit rotation operation on integers</p>



<a name="248547121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248547121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248547121">(Aug 05 2021 at 22:49)</a>:</h4>
<p>It would be very strange if arrays, Vecs, etc inherited all of the properties of their contents, so we put them into a special mode (iterators) to access them</p>



<a name="248547198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248547198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248547198">(Aug 05 2021 at 22:50)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> has repeatedly brought up the iterator comparison</p>



<a name="248547349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248547349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248547349">(Aug 05 2021 at 22:52)</a>:</h4>
<p>Is there perhaps some non-cumbersome way to indicate we are operating on the contents of the vector and not the container itself?  Instead of having a single type with both sets of operations mashed together into one</p>



<a name="248547607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248547607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248547607">(Aug 05 2021 at 22:56)</a>:</h4>
<p>I think the iterator comparison is a little lacking because you can chain iterator operations, but we would rather the API look a little more like regular numbers, but I wouldn't want to call a fn on vectors every time I want to add them, e.g. <code>a.foo() + b.foo()</code></p>



<a name="248548547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248548547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248548547">(Aug 05 2021 at 23:07)</a>:</h4>
<p>maybe have a element ops type and a container ops type, that can be interconverted with special member fns?</p>



<a name="248548710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248548710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248548710">(Aug 05 2021 at 23:09)</a>:</h4>
<p>so, it could look like: <code>(a.el().rotate_left(b.el()) + c * d).co().rotate_left(5)</code></p>



<a name="248548837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248548837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248548837">(Aug 05 2021 at 23:10)</a>:</h4>
<p>where <code>a</code> and <code>b</code> are <code>CoSimd&lt;u32, N&gt;</code> and <code>c</code> and <code>d</code> are <code>ElSimd&lt;u32, N&gt;</code></p>



<a name="248549139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248549139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248549139">(Aug 05 2021 at 23:14)</a>:</h4>
<p>or, now that we have <code>Co</code>/<code>El</code> prefixes, just name them <code>CoVec</code> and <code>ElVec</code>?</p>



<a name="248550837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248550837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248550837">(Aug 05 2021 at 23:39)</a>:</h4>
<p>oh boy that sounds unergonomic</p>



<a name="248550946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248550946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248550946">(Aug 05 2021 at 23:40)</a>:</h4>
<p>i think the default should be to ignore that a vector is happening and always think of it as an element type you're operating on.</p>
<p>then in select cases you might have vector-ish methods, but they're not the default assumption</p>



<a name="248551140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551140">(Aug 05 2021 at 23:43)</a>:</h4>
<p>container-ish perhaps i should say i mean</p>



<a name="248551272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551272">(Aug 05 2021 at 23:45)</a>:</h4>
<p>so, container-ops could be named like <code>container_rotate_right</code> and the bitwise op is <code>rotate_right</code>?</p>



<a name="248551302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551302">(Aug 05 2021 at 23:45)</a>:</h4>
<p>I agree that it's not ergonomic</p>



<a name="248551359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551359">(Aug 05 2021 at 23:46)</a>:</h4>
<p>The problem I have is that if you put all the functions all on one type you still have mix and matched element and vector operations</p>



<a name="248551393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551393">(Aug 05 2021 at 23:47)</a>:</h4>
<p>Also, the related issue of every possible element type function all on one Simd type</p>



<a name="248551675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551675">(Aug 05 2021 at 23:50)</a>:</h4>
<p>random suggestion: a short prefix for vector ops like <code>a.vrotate()</code> (vector op) vs <code>a.rotate()</code> (elementwise bit op)</p>



<a name="248551894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551894">(Aug 05 2021 at 23:54)</a>:</h4>
<p>Unfortunately I think that's not very rusty.  Maybe there's something else in std like that but nothing comes to mind</p>



<a name="248551931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551931">(Aug 05 2021 at 23:54)</a>:</h4>
<p>Also, messing around with the names doesn't deconflict element types, such as signum for both ints and floats</p>



<a name="248551954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248551954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248551954">(Aug 05 2021 at 23:55)</a>:</h4>
<p>I think I keep settling on traits--if your function call is ambiguous the compiler will let you know, and you can use UFCS</p>



<a name="248559152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559152">(Aug 06 2021 at 02:08)</a>:</h4>
<p>container ops can just have more verbose names</p>



<a name="248559182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559182">(Aug 06 2021 at 02:08)</a>:</h4>
<p>like it's totally 100% fine if we call it rotate_elements for clarity</p>



<a name="248559197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559197">(Aug 06 2021 at 02:08)</a>:</h4>
<p>or rotate_lanes or whatever name</p>



<a name="248559215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559215">(Aug 06 2021 at 02:09)</a>:</h4>
<p>Agreed that we can change the name for clarity</p>



<a name="248559272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559272">(Aug 06 2021 at 02:10)</a>:</h4>
<p>I found a silly trick I can do to unify the types piece by piece: <code>pub type SimdF32&lt;const LANES: usize&gt; = Simd&lt;f32, LANES&gt;;</code> :)</p>



<a name="248559294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559294">(Aug 06 2021 at 02:10)</a>:</h4>
<p>what's the problem with signum? it's a consistent interface for both int and float</p>



<a name="248559310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559310">(Aug 06 2021 at 02:11)</a>:</h4>
<p>well, useless for unsigned ints, but still</p>



<a name="248559338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559338">(Aug 06 2021 at 02:11)</a>:</h4>
<p>well</p>



<a name="248559388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559388">(Aug 06 2021 at 02:12)</a>:</h4>
<p>One option is that you implement all of your functions on the 12 primitive types separately</p>



<a name="248559435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559435">(Aug 06 2021 at 02:13)</a>:</h4>
<p>so now not only does your vector have a bunch of container types, but now it has 2 copies of every float op, 5 of every signed int op, etc</p>



<a name="248559448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559448">(Aug 06 2021 at 02:13)</a>:</h4>
<p>so you have 7 signums, not 1 or 2</p>



<a name="248559467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559467">(Aug 06 2021 at 02:13)</a>:</h4>
<p>well signum always returns Self</p>



<a name="248559522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559522">(Aug 06 2021 at 02:14)</a>:</h4>
<p>So then perhaps you implement functions instead of over every type, but over something like <code>impl&lt;T, const LANES: usize&gt; Simd&lt;T; LANES&gt; where T: FloatElement</code></p>



<a name="248559523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559523">(Aug 06 2021 at 02:14)</a>:</h4>
<p>i guess I don't know if it's an intrinsic internally or not</p>



<a name="248559532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559532">(Aug 06 2021 at 02:14)</a>:</h4>
<p>int signum isn't an intrinsic iirc</p>



<a name="248559548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559548">(Aug 06 2021 at 02:15)</a>:</h4>
<p>the problem here is now you have two signums, one for <code>T: FloatElement</code> and one for <code>T: IntElement</code> and they conflict (because the type system allows for a hypothetical <code>T: FloatElement + IntElement</code>)</p>



<a name="248559617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559617">(Aug 06 2021 at 02:16)</a>:</h4>
<p>but why is it T: Float and not just T: Numeric</p>



<a name="248559623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559623">(Aug 06 2021 at 02:16)</a>:</h4>
<p>i guess that would fix things by invoking another bikeshed</p>



<a name="248559625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559625">(Aug 06 2021 at 02:16)</a>:</h4>
<p>Well, in that case it would happen to be <code>T: Signed</code></p>



<a name="248559641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559641">(Aug 06 2021 at 02:16)</a>:</h4>
<p>my point is not that it's not possible, it's that any function you add you may risk needing to add new traits</p>



<a name="248559656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559656">(Aug 06 2021 at 02:17)</a>:</h4>
<p>and you'll end up with quite a few</p>



<a name="248559668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559668">(Aug 06 2021 at 02:17)</a>:</h4>
<p>this is quite literally above our pay grade</p>



<a name="248559674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559674">(Aug 06 2021 at 02:17)</a>:</h4>
<p>that's my point</p>



<a name="248559726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559726">(Aug 06 2021 at 02:18)</a>:</h4>
<p>yeah T-libs-api needs to say what they would find acceptable before you continue or it risks a whole ton of wasted work</p>



<a name="248559735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559735">(Aug 06 2021 at 02:18)</a>:</h4>
<p>the alternative that I'm proposing is that instead you can do</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="n">FloatVector</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="kt">f32</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">signum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248559763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559763">(Aug 06 2021 at 02:19)</a>:</h4>
<p>we can introduce traits that are strictly traits over vectors</p>



<a name="248559779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559779">(Aug 06 2021 at 02:19)</a>:</h4>
<p>and they segment the functionality for different types of vectors</p>



<a name="248559850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559850">(Aug 06 2021 at 02:20)</a>:</h4>
<p>and then you wouldn't need a whole bunch--there are just a few, for each segment of our API</p>



<a name="248559859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559859">(Aug 06 2021 at 02:20)</a>:</h4>
<p>well, what happens when someone wants to impl that for <code>Simd&lt;MyF32Wrapper, 4&gt;</code>?</p>



<a name="248559874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559874">(Aug 06 2021 at 02:21)</a>:</h4>
<p>These traits would be strictly sealed</p>



<a name="248559878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559878">(Aug 06 2021 at 02:21)</a>:</h4>
<p>ah, ok</p>



<a name="248559882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559882">(Aug 06 2021 at 02:21)</a>:</h4>
<p>They must be (so we can add functions in the future)</p>



<a name="248559937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559937">(Aug 06 2021 at 02:22)</a>:</h4>
<p>I don't think there is any hope of allowing SIMD types over custom types, not any time soon at least</p>



<a name="248559982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248559982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248559982">(Aug 06 2021 at 02:23)</a>:</h4>
<p>I don't really want to get bogged down by it, this approach is more amenable to it but I still don't think it's something that will ever happen</p>



<a name="248560087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248560087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248560087">(Aug 06 2021 at 02:25)</a>:</h4>
<p>Especially considering we can't even get u128 to work, and that's a real first-class type!</p>



<a name="248560183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248560183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248560183">(Aug 06 2021 at 02:27)</a>:</h4>
<p>k, though if it's a repr(transparent) wrapper, that should be easier to get working on the compiler side than i128, since no llvm modifications are necessary</p>



<a name="248560281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248560281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248560281">(Aug 06 2021 at 02:29)</a>:</h4>
<p>Yeah, that's true.  My concern is more about how you would expose the compiler intrinsics such that a user could implement their custom functions, without exposing the innards of the compiler</p>



<a name="248560572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248560572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248560572">(Aug 06 2021 at 02:35)</a>:</h4>
<p>Anyway--is there any reason to think for some reason adding traits that abstract over vectors is for some reason out of our scope?</p>



<a name="248569295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569295">(Aug 06 2021 at 03:59)</a>:</h4>
<p>i don't think any needed traits in general are out of scope, i just think they just have a high bar to meet.</p>



<a name="248569635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569635">(Aug 06 2021 at 04:05)</a>:</h4>
<p>Gotcha.</p>



<a name="248569689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569689">(Aug 06 2021 at 04:06)</a>:</h4>
<p>So I tried a different direction of my changes today--if anyone wants to take a look at the <code>feature/generic-element-type</code> branch I've mostly combined all vectors into a single <code>Simd</code> type (I haven't unified masks yet)</p>



<a name="248569715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569715">(Aug 06 2021 at 04:06)</a>:</h4>
<p>As expected a ton of things are simplified--<code>splat</code> etc, all of the various traits (fmt, PartialEq etc), shuffles</p>



<a name="248569730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569730">(Aug 06 2021 at 04:07)</a>:</h4>
<p>I would argue that the API is basically the same with my changes but simpler</p>



<a name="248569779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569779">(Aug 06 2021 at 04:08)</a>:</h4>
<p>The thing that is worse is the documentation, since we have no option but to put all of the docs on one page</p>



<a name="248569800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569800">(Aug 06 2021 at 04:08)</a>:</h4>
<p>It's undoubtedly much harder to read, even though I would argue the API is better</p>



<a name="248569871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569871">(Aug 06 2021 at 04:10)</a>:</h4>
<p>Why don't we go the direction of the primitives? Have a macro_rules that expands out all the code for X type.</p>
<p>I seem to recall we had a pile of macro_rules at one point.</p>



<a name="248569875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569875">(Aug 06 2021 at 04:10)</a>:</h4>
<p>or, do we still?</p>



<a name="248569902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569902">(Aug 06 2021 at 04:11)</a>:</h4>
<p>That's what we have now (and to some extent what we have with my changes, too)</p>



<a name="248569904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569904">(Aug 06 2021 at 04:11)</a>:</h4>
<p>That's not really what I mean</p>



<a name="248569945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569945">(Aug 06 2021 at 04:12)</a>:</h4>
<p>Right now we have <code>SimdF32&lt;N&gt;</code> and <code>SimdF64&lt;N&gt;</code>, with my changes we have <code>Simd&lt;f32, N&gt;</code> and <code>Simd&lt;f64, N&gt;</code></p>



<a name="248569954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569954">(Aug 06 2021 at 04:12)</a>:</h4>
<p>In terms of actual code I think this is strictly an improvement, I don't really see any downsides at all</p>



<a name="248569965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569965">(Aug 06 2021 at 04:13)</a>:</h4>
<p>There is the downside that now rustdoc combines both of <code>Simd&lt;f32, N&gt;</code> and <code>Simd&lt;f64, N&gt;</code> onto one page rather than two</p>



<a name="248569967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248569967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248569967">(Aug 06 2021 at 04:13)</a>:</h4>
<p>That's all I'm saying</p>



<a name="248570021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570021">(Aug 06 2021 at 04:14)</a>:</h4>
<p>but for example, before if you searched the docs for <code>gather_or</code> you got 12 functions, and now you get only 1</p>



<a name="248570438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570438">(Aug 06 2021 at 04:26)</a>:</h4>
<p>Where I am suggesting we go with traits is:<br>
If you look at the API with my changes you'll see for example 7 abs fns, one each for <code>f32</code>, <code>f64</code>, <code>i8</code>, <code>i16</code>, <code>i32</code>, <code>i64</code>, and <code>isize</code>.  These are all completely separate functions.  What we could do instead is have two traits, and then you will have only two functions: <code>Float::abs</code> and <code>Int::abs</code></p>



<a name="248570449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570449">(Aug 06 2021 at 04:27)</a>:</h4>
<p>Then you will have a <code>Simd&lt;T, N&gt;</code>, and depending on <code>T</code> you may also implement <code>Float</code>, and if you do, you get an <code>abs</code> fn</p>



<a name="248570513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570513">(Aug 06 2021 at 04:29)</a>:</h4>
<p>I think code-wise this is better because you don't have duplicate fns for every time--you have one fn that may or may not be implemented on <code>Simd</code>.  Discoverability-wise I think this is also better because if you look at <code>Simd</code> you will see a list of things that are common to all vectors, like shuffles, splat, etc, and you can look at the traits for particular functionality unique to specific vectors</p>



<a name="248570573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570573">(Aug 06 2021 at 04:30)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> I am curious what you think of this as well--this is basically an inversion of where I think you originally wanted to go with this, but to the same end.</p>



<a name="248570596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570596">(Aug 06 2021 at 04:31)</a>:</h4>
<p>Instead of having a <code>Vector</code> trait with common impls and then each specific type has special functionality, you have a common <code>Simd</code> type that has the common impls, and then specific traits with extra functionality</p>



<a name="248570690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570690">(Aug 06 2021 at 04:34)</a>:</h4>
<p>A little example of what I mean:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[repr(simd)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Simd</span><span class="o">&lt;</span><span class="n">Element</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">([</span><span class="n">Element</span><span class="p">;</span><span class="w"> </span><span class="n">LANES</span><span class="p">]);</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">Element</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="n">Element</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">splat</span><span class="p">(</span><span class="n">value</span>: <span class="nc">Element</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">Self</span><span class="p">([</span><span class="n">value</span><span class="p">;</span><span class="w"> </span><span class="n">LANES</span><span class="p">])</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Float</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">abs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Float</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="kt">f32</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Float</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Simd</span><span class="o">&lt;</span><span class="kt">f64</span><span class="p">,</span><span class="w"> </span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248570767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570767">(Aug 06 2021 at 04:35)</a>:</h4>
<p>I quite like that idea!</p>



<a name="248570850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570850">(Aug 06 2021 at 04:37)</a>:</h4>
<p>In terms of end-user experience, the trade off is now you need to add <code>use std::simd::Float;</code>, but the benefit is the API just shrunk by 5-10x</p>



<a name="248570918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570918">(Aug 06 2021 at 04:39)</a>:</h4>
<p>I think <code>use std::simd::prelude::*;</code> is better...</p>



<a name="248570968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570968">(Aug 06 2021 at 04:40)</a>:</h4>
<p>I think the argument there would be to put these traits in the actual prelude, then</p>



<a name="248570980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570980">(Aug 06 2021 at 04:41)</a>:</h4>
<p>in that case, they definitely should be named <code>SimdFloat</code> unless they will be usable for non-simd types</p>



<a name="248570986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570986">(Aug 06 2021 at 04:41)</a>:</h4>
<p>Yeah, you're probably right</p>



<a name="248570990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248570990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248570990">(Aug 06 2021 at 04:41)</a>:</h4>
<p>I think these traits would be specifically SIMD</p>



<a name="248571053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571053">(Aug 06 2021 at 04:43)</a>:</h4>
<p>perhaps I'm being optimistic, but I think the entire API would boil down to <code>Simd</code>, <code>SimdFloat</code>, <code>SimdSignedInt</code>, <code>SimdUnsignedInt</code>, <code>Mask</code>, <code>LaneCount</code>, <code>SupportedLaneCount</code></p>



<a name="248571103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571103">(Aug 06 2021 at 04:44)</a>:</h4>
<p>the <code>Vector</code>, <code>Mask</code>, and <code>Select</code> traits would no longer be necessary, and in terms of structs we go from 17 to 2</p>



<a name="248571118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571118">(Aug 06 2021 at 04:45)</a>:</h4>
<p>sounds about right, though we might want a separate bitmask type</p>



<a name="248571125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571125">(Aug 06 2021 at 04:45)</a>:</h4>
<p>yeah, if we can ever work that out</p>



<a name="248571127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571127">(Aug 06 2021 at 04:45)</a>:</h4>
<p>but for now we have just the opaque mask type</p>



<a name="248571154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571154">(Aug 06 2021 at 04:46)</a>:</h4>
<p>once we add pointers we would probably get one or two more traits, but no new structs</p>



<a name="248571180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571180">(Aug 06 2021 at 04:46)</a>:</h4>
<p>unless we get generic ints first, in which case we just write <code>Mask&lt;int&lt;1&gt;, N&gt;</code></p>



<a name="248571185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571185">(Aug 06 2021 at 04:46)</a>:</h4>
<p>yep</p>



<a name="248571268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571268">(Aug 06 2021 at 04:48)</a>:</h4>
<p>or, better yet, <code>FixedMask&lt;int&lt;1&gt;, N&gt;</code> to indicate non-opaque layout</p>



<a name="248571297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571297">(Aug 06 2021 at 04:49)</a>:</h4>
<p>yeah, well, it could actually just be <code>Simd&lt;i1, N&gt;</code></p>



<a name="248571299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571299">(Aug 06 2021 at 04:49)</a>:</h4>
<p>since we'd probably want <code>FixedMask&lt;i32, N&gt;</code></p>



<a name="248571436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571436">(Aug 06 2021 at 04:52)</a>:</h4>
<p>I'd imagine LLVM might get support for indicating particular vectors are masks, allowing skipping unnecessary instructions, <code>FixedMask</code> could be how we tell LLVM that a type isn't just any arbitrary <code>Simd&lt;i32, N&gt;</code> value</p>



<a name="248571459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248571459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248571459">(Aug 06 2021 at 04:53)</a>:</h4>
<p>currently LLVM just guesses from the operations it can see -- but totally fails across memory/function boundaries</p>



<a name="248617000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248617000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248617000">(Aug 06 2021 at 14:21)</a>:</h4>
<p>I think one thing is, current rust programmers are used to having many identical functions, one for each type. Having an extra 7 copies of <code>abs</code> isn't a huge deal.</p>



<a name="248617305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248617305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248617305">(Aug 06 2021 at 14:23)</a>:</h4>
<p>So I agree-the difference is if you search abs in std right now you get <code>f32::abs</code>, <code>f64::abs</code> etc, in this case you will just have <code>Simd::abs</code> listed a bunch of times</p>



<a name="248617977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248617977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248617977">(Aug 06 2021 at 14:28)</a>:</h4>
<p>wouldn't it be SimdF32::abs, etc?</p>



<a name="248618067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618067">(Aug 06 2021 at 14:29)</a>:</h4>
<p>No, the whole point of my change is that there is a single vector type <code>Simd&lt;T, N&gt;</code></p>



<a name="248618119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618119">(Aug 06 2021 at 14:30)</a>:</h4>
<p>Just as arrays are a single generic type</p>



<a name="248618297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618297">(Aug 06 2021 at 14:31)</a>:</h4>
<p>right right, i mean if we didn't make this change to generic element, we see SimdF32::abs</p>
<p>so what if we teach rustdoc that it should show some amount of generics in the search results?</p>



<a name="248618329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618329">(Aug 06 2021 at 14:31)</a>:</h4>
<p>Currently yes, that is what you would see</p>



<a name="248618377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618377">(Aug 06 2021 at 14:32)</a>:</h4>
<p>Yeah, you could potentially improve rustdoc</p>



<a name="248618460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248618460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248618460">(Aug 06 2021 at 14:32)</a>:</h4>
<p>Though I don't think there is any good way to deal with the <code>Simd</code> type having hundreds of functions to sort through</p>



<a name="248619181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248619181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248619181">(Aug 06 2021 at 14:39)</a>:</h4>
<p>no but we can at least make it show as Simd&lt;f32,N&gt;::abs in search results</p>



<a name="248620647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248620647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248620647">(Aug 06 2021 at 14:51)</a>:</h4>
<p>Yep, that's true</p>



<a name="248620669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248620669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248620669">(Aug 06 2021 at 14:51)</a>:</h4>
<p>Is there any good reason it shouldn't be a trait though?</p>



<a name="248649759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248649759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248649759">(Aug 06 2021 at 18:27)</a>:</h4>
<p>Well traits doc worse than methods for one</p>



<a name="248649982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248649982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248649982">(Aug 06 2021 at 18:29)</a>:</h4>
<p>I mean we can use a pile of traits but as soon as you've got traits for number types in simd someone is gonna want those traits for number types in scalar, and that's a can of worms.</p>



<a name="248685394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248685394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248685394">(Aug 07 2021 at 00:58)</a>:</h4>
<p>Hello it will take a bit before I can review this thread properly.</p>



<a name="248697411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unified%20vector%20types/near/248697411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unified.20vector.20types.html#248697411">(Aug 07 2021 at 05:20)</a>:</h4>
<p>This is a good example of the implementation improvements we get: <a href="https://github.com/rust-lang/portable-simd/commit/ea0280539cfee50c02fb5ed87960390d2d68008b?branch=ea0280539cfee50c02fb5ed87960390d2d68008b&amp;diff=split">https://github.com/rust-lang/portable-simd/commit/ea0280539cfee50c02fb5ed87960390d2d68008b?branch=ea0280539cfee50c02fb5ed87960390d2d68008b&amp;diff=split</a></p>
<p>Only one <code>select</code> implementation now!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>